package cn.lzd.mr.case1;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created by lzd on 2018/5/31.
 */
public class Test {
    public static void main(String[] args) throws IOException {
        String path = Test.class.getResource("/case1/text").getPath();
        System.out.println(path);
        List<String> list = FileUtils.readLines(new File(path));
        list.forEach(System.out::println);

        list.forEach(($) -> {
            String[] split = $.split(" ");
            List<String> res = Stream.of(split).filter((x) -> StringUtils.isNotBlank(x)).collect(Collectors.toList());
//            System.out.println(res.get(res.size() - 2));
//            System.out.println(res.get(res.size() - 3));
            System.out.println(res.size());
        });
    }
}
